package com.kly.common;

import com.kly.exception.ErrorCode;
import lombok.Data;

import java.io.Serializable;

/**
 * @author admin
 * @date 2025/3/2
 */
@Data
public class BaseResponse <T> implements Serializable {
    private static final long serialVersionUID = -7849952701765997864L;

    private int code;

    private T data;

    private String message;


    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public BaseResponse(int code, T data) {
        this(code, data, "");
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null,  errorCode.getMessage());
    }
}
